package hong.tmp;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;

public class TimeDownApp extends Application {

    private int num = 0;
    private Button btn;
    @Override
    public void start(Stage primaryStage) throws Exception {
        try {
            btn = new Button("btn001");
//            btn = new Button("单击一下");//中文报错
            btn.setOnMouseClicked((MouseEvent e)->{
                num ++;
                System.out.println("..."+num);
            });
            btn.setTranslateX(100);
            btn.setTranslateY(100);
            Pane root = new Pane();
            root.getChildren().add(btn);
            Scene scene = new Scene(root, 500, 500);
            primaryStage.setScene(scene);
            primaryStage.setTitle("倒计时");
            primaryStage.show();
        } catch(Exception e) {
            e.printStackTrace();
        }
    }
}
